var i = getApp(), t = require("../../339469457B99569C55F201426D89DBD0.js"), e = require("../../38034BA77B99569C5E6523A090A9DBD0.js"), o = t.getImgCheckurl(), g = t.getVsionimgfilterurl(), m = t.getPtuimgfilterurl();

Page({
    data: {
        motto: "腾讯优图",
        images: {},
        img: "",
        remark: "",
        model: 0,
        tempFilePaths: "",
        userInfo: {},
        currentTab: 0,
        backUserInfo: {},
        hasUserInfo: !1,
        openId: "",
        nickName: "",
        canIUse: wx.canIUse("button.open-type.getUserInfo"),
        imgfilterPT: [ {
            id: "1",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/ptuimgfilter/1.png",
            text: "黛紫"
        }, {
            id: "2",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/ptuimgfilter/2.png",
            text: "岩井"
        }, {
            id: "3",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/ptuimgfilter/3.png",
            text: "粉嫩"
        }, {
            id: "4",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/ptuimgfilter/4.png",
            text: "错觉"
        }, {
            id: "5",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/ptuimgfilter/5.png",
            text: "暖阳"
        }, {
            id: "6",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/ptuimgfilter/6.png",
            text: "浪漫"
        }, {
            id: "7",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/ptuimgfilter/7.gif",
            text: "蔷薇"
        }, {
            id: "8",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/ptuimgfilter/8.gif",
            text: "睡莲"
        }, {
            id: "9",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/ptuimgfilter/9.gif",
            text: "糖果玫瑰"
        }, {
            id: "10",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/ptuimgfilter/10.gif",
            text: "新叶"
        }, {
            id: "11",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/ptuimgfilter/11.gif",
            text: "尤加利"
        }, {
            id: "12",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/ptuimgfilter/12.png",
            text: "墨"
        }, {
            id: "13",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/ptuimgfilter/13.png",
            text: "玫瑰初雪"
        }, {
            id: "14",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/ptuimgfilter/14.png",
            text: "樱桃布丁"
        }, {
            id: "15",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/ptuimgfilter/15.png",
            text: "白茶"
        }, {
            id: "16",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/ptuimgfilter/16.png",
            text: "甜薄荷"
        }, {
            id: "17",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/ptuimgfilter/17.png",
            text: "樱红"
        }, {
            id: "18",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/ptuimgfilter/18.png",
            text: "圣代"
        }, {
            id: "19",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/ptuimgfilter/19.png",
            text: "莫斯科"
        }, {
            id: "20",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/ptuimgfilter/20.png",
            text: "冲绳"
        }, {
            id: "21",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/ptuimgfilter/21.png",
            text: "粉碧"
        }, {
            id: "22",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/ptuimgfilter/22.png",
            text: "地中海"
        }, {
            id: "23",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/ptuimgfilter/23.png",
            text: "首尔"
        }, {
            id: "24",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/ptuimgfilter/24.png",
            text: "佛罗伦萨"
        }, {
            id: "25",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/ptuimgfilter/25.png",
            text: "札幌"
        }, {
            id: "26",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/ptuimgfilter/26.png",
            text: "栀子"
        }, {
            id: "27",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/ptuimgfilter/27.png",
            text: "东京"
        }, {
            id: "28",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/ptuimgfilter/28.png",
            text: "昭和"
        }, {
            id: "29",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/ptuimgfilter/29.gif",
            text: "自然"
        }, {
            id: "30",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/ptuimgfilter/30.png",
            text: "清逸"
        }, {
            id: "31",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/ptuimgfilter/31.png",
            text: "染"
        }, {
            id: "32",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/ptuimgfilter/32.png",
            text: "甜美"
        } ],
        imgfilterVision: [ {
            id: "1",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/1.jpg",
            text: "1"
        }, {
            id: "2",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/2.jpg",
            text: "2"
        }, {
            id: "3",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/3.jpg",
            text: "3"
        }, {
            id: "4",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/4.jpg",
            text: "4"
        }, {
            id: "5",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/5.jpg",
            text: "5"
        }, {
            id: "6",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/6.jpg",
            text: "6"
        }, {
            id: "7",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/7.jpg",
            text: "7"
        }, {
            id: "8",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/8.jpg",
            text: "8"
        }, {
            id: "9",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/9.jpg",
            text: "9"
        }, {
            id: "10",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/10.jpg",
            text: "10"
        }, {
            id: "11",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/11.jpg",
            text: "11"
        }, {
            id: "12",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/12.jpg",
            text: "12"
        }, {
            id: "13",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/13.jpg",
            text: "13"
        }, {
            id: "14",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/14.jpg",
            text: "14"
        }, {
            id: "15",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/15.jpg",
            text: "15"
        }, {
            id: "16",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/16.jpg",
            text: "16"
        }, {
            id: "17",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/17.jpg",
            text: "17"
        }, {
            id: "18",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/18.jpg",
            text: "18"
        }, {
            id: "19",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/19.jpg",
            text: "19"
        }, {
            id: "20",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/20.jpg",
            text: "20"
        }, {
            id: "21",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/21.jpg",
            text: "21"
        }, {
            id: "22",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/22.jpg",
            text: "22"
        }, {
            id: "23",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/23.jpg",
            text: "23"
        }, {
            id: "24",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/24.jpg",
            text: "24"
        }, {
            id: "25",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/25.jpg",
            text: "25"
        }, {
            id: "26",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/26.jpg",
            text: "26"
        }, {
            id: "27",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/27.jpg",
            text: "27"
        }, {
            id: "28",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/28.jpg",
            text: "28"
        }, {
            id: "29",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/29.jpg",
            text: "29"
        }, {
            id: "30",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/30.jpg",
            text: "30"
        }, {
            id: "31",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/31.jpg",
            text: "31"
        }, {
            id: "32",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/32.jpg",
            text: "32"
        }, {
            id: "33",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/33.jpg",
            text: "33"
        }, {
            id: "34",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/34.jpg",
            text: "34"
        }, {
            id: "35",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/35.jpg",
            text: "35"
        }, {
            id: "36",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/36.jpg",
            text: "36"
        }, {
            id: "37",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/37.jpg",
            text: "37"
        }, {
            id: "38",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/38.jpg",
            text: "38"
        }, {
            id: "39",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/39.jpg",
            text: "39"
        }, {
            id: "40",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/40.jpg",
            text: "40"
        }, {
            id: "41",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/41.jpg",
            text: "41"
        }, {
            id: "42",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/42.jpg",
            text: "42"
        }, {
            id: "43",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/43.jpg",
            text: "43"
        }, {
            id: "44",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/44.jpg",
            text: "44"
        }, {
            id: "45",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/45.jpg",
            text: "45"
        }, {
            id: "46",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/46.jpg",
            text: "46"
        }, {
            id: "47",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/47.jpg",
            text: "47"
        }, {
            id: "48",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/48.jpg",
            text: "48"
        }, {
            id: "49",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/49.jpg",
            text: "49"
        }, {
            id: "50",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/50.jpg",
            text: "50"
        }, {
            id: "51",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/51.jpg",
            text: "51"
        }, {
            id: "52",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/52.jpg",
            text: "52"
        }, {
            id: "53",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/53.jpg",
            text: "53"
        }, {
            id: "54",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/54.jpg",
            text: "54"
        }, {
            id: "55",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/55.jpg",
            text: "55"
        }, {
            id: "56",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/56.jpg",
            text: "56"
        }, {
            id: "57",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/57.jpg",
            text: "57"
        }, {
            id: "58",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/58.jpg",
            text: "58"
        }, {
            id: "59",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/59.jpg",
            text: "59"
        }, {
            id: "60",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/60.jpg",
            text: "60"
        }, {
            id: "61",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/61.jpg",
            text: "61"
        }, {
            id: "62",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/62.jpg",
            text: "62"
        }, {
            id: "63",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/63.jpg",
            text: "63"
        }, {
            id: "64",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/64.jpg",
            text: "64"
        }, {
            id: "65",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/visionimgfilter/65.jpg",
            text: "65"
        } ],
        token: null
    },
    onShareAppMessage: function() {
        return {
            title: "给图片加个滤镜",
            path: "/pages/imgfilter/imgfilter",
            success: function(i) {
                "shareAppMessage:ok" == i.errMsg && wx.showToast({
                    title: "分享成功",
                    icon: "success",
                    duration: 500
                });
            },
            fail: function(i) {
                "shareAppMessage:fail cancel" == i.errMsg && wx.showToast({
                    title: "分享取消",
                    icon: "loading",
                    duration: 500
                });
            }
        };
    },
    bindViewTap: function() {
        wx.navigateTo({
            url: "../logs/logs"
        });
    },
    clickTab: function(i) {
        var t = this;
        if (this.data.currentTab === i.target.dataset.current) return !1;
        t.setData({
            currentTab: i.target.dataset.current
        });
    },
    onFaceMerge: function(i) {
        var t = this, e = "";
        e = "0" == this.data.currentTab ? m : g;
        var s = i.currentTarget.dataset.id;
        t.data.tempFilePaths ? (t.setData({
            model: s
        }), setTimeout(function() {
            wx.showLoading({
                title: "智能处理中",
                icon: "loading",
                mask: !0
            });
        }, 500), wx.uploadFile({
            url: o,
            filePath: i.tempFilePaths[0],
            header: {
                "content-type": "multipart/form-data"
            },
            name: "file",
            formData: {
                code: "XSYD"
            },
            success: function(i) {
                var o = JSON.parse(i.data);
                "0" == o.errcode ? wx.uploadFile({
                    url: e,
                    filePath: t.data.tempFilePaths[0],
                    header: {
                        "content-type": "multipart/form-data"
                    },
                    name: "file",
                    formData: {
                        model: s
                    },
                    success: function(i) {
                        var e = i.data, o = JSON.parse(e);
                        console.log(o.ret), 0 == o.ret ? (wx.hideLoading(), t.setData({
                            img: "data:image/png;base64," + o.data.image
                        })) : 16402 == o.ret ? (wx.hideLoading(), wx.showModal({
                            title: "温馨提示",
                            content: "图片中不包含人脸哦",
                            showCancel: !1
                        })) : (wx.hideLoading(), wx.showModal({
                            title: "温馨提示",
                            content: "服务器远走高飞了",
                            showCancel: !1
                        })), wx.hideToast();
                    },
                    fail: function(i) {
                        wx.hideToast(), wx.hideLoading(), wx.showModal({
                            title: "上传失败",
                            content: "服务器远走高飞了",
                            showCancel: !1
                        });
                    }
                }) : "87014" == o.errcode ? (wx.hideLoading(), wx.showModal({
                    content: "存在敏感内容，请更换图片",
                    showCancel: !1,
                    confirmText: "明白了"
                }), t.setData({
                    img: null
                })) : (wx.hideLoading(), wx.showModal({
                    content: "其他错误，稍后再试",
                    showCancel: !1,
                    confirmText: "明白了"
                }));
            }
        })) : wx.showToast({
            title: "快选择图片吧",
            icon: "none",
            mask: !0,
            duration: 1e3
        });
    },
    chooseImage: function() {
        var i = this;
        wx.chooseImage({
            count: 1,
            sourceType: [ "album", "camera" ],
            sizeType: [ "compressed" ],
            success: function(t) {
                console.log(t), t.tempFiles[0].size > 512e3 ? wx.showToast({
                    title: "图片文件过大哦",
                    icon: "none",
                    mask: !0,
                    duration: 1500
                }) : i.setData({
                    img: t.tempFilePaths[0],
                    tempFilePaths: t.tempFilePaths
                });
            }
        });
    },
    onLoad: function() {
        var t = this, o = i.data.openId;
        this.setData({
            openId: o
        }), e.tokenRequest({
            success: function(i) {
                t.setData({
                    token: i.access_token
                });
            }
        });
    },
    preview: function(i) {
        var t = this;
        wx.previewImage({
            urls: [ t.data.img ],
            current: t.data.img
        });
    }
});